﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using NTiering.Models;

namespace NTiering.Mappers
{
    public class DefaultMapper<Tfrom,Tto> :IMapper<Tfrom,Tto>
        where Tfrom : IModel,new()
        where Tto : IModel,new()
    {
        /// <summary>
        /// Maps property data from one object to another
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public Tto Map(Tfrom from)
        {          
            Mapper.CreateMap<Tfrom, Tto>();
            var rtn = Mapper.Map<Tfrom, Tto>(from);
            return rtn ;
        }

    }
}
